<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxml="urn:schemas-microsoft-com:xslt"
  xmlns:site.library="urn:site.library"
  xmlns:umbraco.library="urn:umbraco.library"
  xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
  xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
  xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
  xmlns:examine="urn:examine"
  exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets site.library examine ">

  <xsl:output method="xml" omit-xml-declaration="yes"/>

  <xsl:variable name="Page" select="site.library:CurrentPage()"/>
  <xsl:variable name="SiteInfo" select="site.library:PageSite($Page/@id)"/>
  <xsl:variable name="Site" select="umbraco.library:GetXmlNodeById($SiteInfo/node/@id)"/>
  <xsl:variable name="IsEditMode" select="site.library:IsCanvas()"/>

  <xsl:template match="/">
    <div class="logo-holder {site.library:ShortIf($IsEditMode,' canvas_edit','')}">
      <xsl:if test="$IsEditMode"><xsl:attribute name="onclick">javascript:showEditNodeDialog('<xsl:value-of select="$SiteInfo/node/@id"/>','Edit Site Data, logo image');return false;</xsl:attribute></xsl:if>
      <a href="{umbraco.library:NiceUrl($Site/@id)}">
        <xsl:if test="$IsEditMode"><xsl:attribute name="onclick">javascript:showEditNodeDialog('<xsl:value-of select="$SiteInfo/node/@id"/>','Edit Site Data, logo image');return false;</xsl:attribute></xsl:if>
        <xsl:if test="count($Site/logoImage/*)>0 or $IsEditMode">
          <xsl:variable name="logoImageUrl" select="site.library:GetImageUrl($Site/logoImage/*[1], '/media/site_logo.png')"/>
          <img alt="{$SiteInfo/node/@name}"  src="{$logoImageUrl}" class="slogo"/>
        </xsl:if>
        <xsl:if test ="string-length($Site/sloganTitle)>0">
          <span class="stitle">
            <xsl:value-of select="$Site/sloganTitle"/>
          </span>
        </xsl:if>
      </a>
    </div>
  </xsl:template>

</xsl:stylesheet>